<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>卓越物流管理系统</title>
<style>
    #baiduMap{
        height:500px;width:700px;
    }
    .div {
        width:700px;
        height:500px;
        border:5px solid black;
    }
    .title_right{
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="js/xadmin.js"></script>
<script type="text/javascript" src="js/cookie.js"></script>
    <script type="text/javascript" src="js/address.js"></script>
<!--百度地图API-->
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=8nTRAKtZXD0wQ1tzTpcT7lcV1tzgKYTx"></script>

</head>

<body>
<script>
    $(function(){

        //百度地图API功能
        var map = new BMap.Map("baiduMap");
        map.centerAndZoom(new BMap.Point(113.542879,34.824115),12);
        map.setCurrentCity("郑州");
        map.enableScrollWheelZoom(true);
        // 添加比例尺控件
        map.addControl(new BMap.ScaleControl());

        var url = location.search;
        console.log(url);
        var id=url.split("=")[1];
        var str= address + "transNode/get/" + id;
            $.ajax({
                url: str,
                type: "GET",
                dataType: "json",
                contentType : "application/json; charset=utf-8",
                success:function(data){

                    if(data.code.code === 0) {
                        var transNode = data.transNode;

                        // var map = new BMap.Map("allmap");
                        // map.enableScrollWheelZoom(true);

                        // 用经纬度设置地图中心点
                        if(transNode.x==null && transNode.y==null){
                            alert("网点信息错误");
                        }
                        if(transNode.x!=null && transNode.y!=null){
                            //清除地图上生成的信息113.824444  36.190519
                            map.clearOverlays();
                            var new_point = new BMap.Point(transNode.x,transNode.y);
                            // 将创建的标注添加到地图中
                            map.addOverlay(new BMap.Marker(new_point));
                            //地图中心
                            map.panTo(new_point);
                        }
                    }else{
                        alert(data.code.message);
                    }
                },
                error:function(){
                    alert("error");
                }
            });
    });
</script>
    <div id="middle">
         <div class="right"  id="mainFrame">
             <div class="right_cont">
                 <div style=" margin: auto;width: 1200px;">
                     <!--地图模块-->
                     <div id="baiduMap" class="div"></div>
                 </div>
                 <br><br><br><br>
              </div>
         </div>
    </div>
<script type="text/javascript">

</script>
</body>
</html>